$(function(){
	$('.firstSubmitBtn').click(function(){
		var usr = $("input[name='usr']").val();
		var pwd = $("input[name='pwd']").val();
		var passwd;
		//check input
		if ($.trim(usr)==""||$.trim(usr)==null){
			$('#usrInfo').empty();
			$('#usrInfo').append("请输入用户名");
			return false;
		}
		if ($.trim(pwd)==""||$.trim(pwd)==null){
			$('#pwdInfo').empty();
			$('#pwdInfo').append("请输入密码");
			return false;
		}else{
			passwd = $.md5($.trim(pwd));
		}
		
		if($.trim(usr)!=""&&passwd!=""){
			$.ajax({
				type: 'POST',
				url: basePath + 'account/loginpass.do',
				data: {
					'usr': usr,
					'pwd': passwd
				},
				dataType: 'json',
				success: function (data){
					if (data.result=='success'){
						window.location.href = basePath + 'home/index.do';
					} else if (data.result=='failure'){
						window.location.href = basePath + 'account/login.do';
					}
				}
			});
		}
	})
})
